package Aop.Component;

import Aop.Annotation.BeansXml;

import java.io.File;
import java.lang.annotation.Annotation;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;

public class MyIoc {
    private Class aClass;
    public MyIoc(Class t)  {
        init(t);
    }
    public void init(Class t)  {
        aClass = t;
        BeansXml annotation = (BeansXml) aClass.getAnnotation(BeansXml.class);
        String path = annotation.value();
        path = path.replace(".","/");

        ClassLoader classLoader = MyIoc.class.getClassLoader();
        URL resource = classLoader.getResource(path);

        File my = new File(resource.getPath());
        File[] files = my.listFiles();
        for (File file :files) {
            String absolutePath = file.getAbsolutePath();

            if (absolutePath.endsWith(".class")){
                String name = absolutePath.substring(absolutePath.lastIndexOf("\\")+1,absolutePath.indexOf("."));




            }

        }


    }
}
